﻿<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
	<meta http-equiv="Pragma" content="no-cache" />
	<meta http-equiv="Expires" content="0" />
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<!--[if lt IE 9]>
	<script type="text/javascript" src="/lib/html5shiv.js"></script>
	<script type="text/javascript" src="/lib/respond.min.js"></script>
	<![endif]-->
	<link rel="stylesheet" type="text/css" href="/static/h-ui/css/H-ui.min.css" />
	<link rel="stylesheet" type="text/css" href="/static/h-ui.admin/css/H-ui.admin.css" />
	<link rel="stylesheet" type="text/css" href="/lib/Hui-iconfont/1.0.8/iconfont.css" />
	<link rel="stylesheet" type="text/css" href="/static/h-ui.admin/skin/default/skin.css" id="skin" />
	<link rel="stylesheet" type="text/css" href="/static/h-ui.admin/css/style.css" />
	<!--[if IE 6]>
	<script type="text/javascript" src="/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
	<script>DD_belatedPNG.fix('*');</script>
	<![endif]-->
	<title>推送用户列表</title>
	<style type="text/css" media="screen">
		a {
			color: #2B4A78;
			text-decoration: none;
		}

		a:hover {
			color: #2B4A78;
			text-decoration: underline;
		}

		a:focus, input:focus {
			outline-style: none;
			outline-width: medium;
		}

		/* custom css style: pageNum,cPageNum */
		.pageNum {
			border: 1px solid #999;
			padding: 2px 8px;
			display: inline-block;
		}

		.cPageNum {
			font-weight: bold;
			padding: 2px 5px;
		}
		#pageNav{
			-moz-user-select: none;
			-webkit-user-select: none;
			-ms-user-select: none;
		}
		#pageNav a:hover {
			text-decoration: none;
			background: #fff4d8;
		}

	</style>
	<link rel="stylesheet" type="text/css" href="/layui.css" />
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 推送用户 </nav>
<div class="page-container">

	<div class="cl pd-5 bg-1 bk-gray mt-20" style="padding: 27px 5px 5px 5px;">
		<div style="height: 22px; text-align: right;">共有数据：<strong th:text="${total}"></strong> 条</div>
	</div>


	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-hover  table-responsive">
			<thead>
			<tr class="text-c">
				<th>ID</th>
				<th >用户名称</th>
				<th>推送状态</th>
				<th>信息反馈</th>
				<th >最后推送时间</th>
				<th width="120">操作</th>
			</tr>
			</thead>
			<tbody id="user_tbody">

			<!--<tr th:each="user:${userList}" class="text-c">-->
			<!--<td th:text="${user.uid}"></td>-->
			<!--<td th:text="${user.uname}"></td>-->
			<!--&lt;!&ndash;用户状态为1表示正常，为0表示禁用&ndash;&gt;-->
			<!--<td th:if="${user.status} eq 1" class="td-status"><span class="label label-success radius">正常</span></td>-->
			<!--<td th:if="${user.status} eq 0" class="td-status"><span  class="label label-danger radius">已禁用</span></td>-->
			<!--<td th:if="${user.status} eq 0" class="f-14 td-manage"><a  style="text-decoration:none ;color: #0000cc  " th:onclick="'javascript:start('+${user.uid}+')'" href="javascript:;" title="启用">启用</a>-->
			<!--<td th:if="${user.status} eq 1"class="f-14 td-manage"><a style="text-decoration:none ;color: #0000cc " th:onclick="'javascript:forbidden('+${user.uid}+')'" href="javascript:;" title="禁用">禁用</a>-->
			<!--</tr>-->
			</tbody>
		</table>
		<script type="text/javascript" src="/pagenav1.1.cn.js"></script>
		<script type="text/javascript" src="/jquery.js"></script>
		<script th:inline="javascript" type="text/javascript">

            //$(function(){ //for jquery
            window.onload = (function(){
                //判断是查看要推送的全部用户，推送失败的用户，还是推送成功的用户
                if([[${flag}]]=="all"){
                    var url="/queryAllUserByConId";
				}else if([[${flag}]]=="success"){
                    var url="/querySuccessUser";
				}else {
                    var url="/queryFailureUser";
				}
                //optional set
                pageNav.pre="上一页";
                pageNav.next="下一页";


                //  p,当前页码,pn,总页面
                pageNav.fn = function(p,pn){
                    // document.getElementById("test").innerHTML ="当前页:"+p+"  ,  总页: "+pn;
                    //$("#test").text("Page:"+p+" of "+pn + " pages."); // jquery调用方式
                    //alert(p);
                    $.post(url, {
                            start: (p-1)*20,
                            limit:20,
                            con_id:[[${con_id}]]
                        },
                        function (data) {
                            var tbody=$("#user_tbody");
                            tbody.html("");
                            var trData="";

                            $.each(data, function (i, item) {
                                trData += "<tr><td style='text-align: center'>"+ item.uid +"</td><td style='text-align: center'>"+ item.uname +"</td>"
                                if(item.status==1){
                                    trData+="<td style='text-align: center' class=\"td-status\"><span  class=\"label label-success radius\">成功</span></td><td style='text-align: center'>"+item.error_msg+"</td><td style='text-align: center'>"+item.formatTime+"</td>"+"<td style='text-align: center' class=\"f-14 td-manage\"><a style=\"text-decoration:none ;color: #0000cc \" onclick='pushTopByUser("+item.con_id+","+item.uid+")'  title=\"手动推送\">手动推送</a></td>"
                                }
                                if(item.status==3){
                                    trData+="<td style='text-align: center' class=\"td-status\"><span  class=\"label label-danger radius\">失败</span></td><td style='text-align: center'>"+item.error_msg+"</td><td style='text-align: center'>"+item.formatTime+"</td>"+"<td style='text-align: center' class=\"f-14 td-manage\"><a style=\"text-decoration:none ;color: #0000cc \" onclick='pushTopByUser("+item.con_id+","+item.uid+")'   title=\"手动推送\">手动推送</a></td>"
                                }
                                if(item.status==0){
                                    trData+="<td style='text-align: center' class=\"td-status\"><span  class=\"label label-danger radius\">未推送</span></td><td style='text-align: center'>"+item.error_msg+"</td><td style='text-align: center'>"+item.formatTime+"</td>"+"<td style='text-align: center' class=\"f-14 td-manage\"><a style=\"text-decoration:none ;color: #0000cc \" onclick='pushTopByUser("+item.con_id+","+item.uid+")'   title=\"手动推送\">手动推送</a></td>"
								}
                            });
                            tbody.append(trData);
                        });

                };
                //每页数显示条数固定20条
                pageNav.go(1, [[${totalPage}]]);
            });
		</script>
		<!--<div id="test" style="height:70px;padding:30px 10px;font-size: 300%;"></div>-->

		<div style="float: right" id="pageNav"></div>
	</div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="/my.js"></script>

<script type="text/javascript" src="/layui.all.js">
    layui.use('form', function(){
        var form = layui.form;
    });
</script>
<script type="text/javascript">
	//手动推送确认
    function pushTopByUser(con_id,uid) {
        layer.confirm("确认要手动推送吗", { title: "手动推送确认" }, function (index) {
            layer.close(index);

            $.post("/pushTopByUser", {
                    uid: uid,
                    con_id:con_id
                },
                function (data) {
                    var datares=eval(data)
                    layer.alert(datares.msg, {
                            title: "手动推送操作",
                            btn: ['确定']
                        },
                        function (index, item) {
                            //layer.close(index);
                            location.reload();
                        });
                });
        });
    }

</script>
</body>
</html>